package com.tianruan.dc.modules.sys.user.service;


import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tianruan.dc.common.utils.PageUtils;
import com.tianruan.dc.modules.sys.user.entity.db.UserDO;
import com.tianruan.dc.modules.sys.user.entity.dto.LoginDTO;
import com.tianruan.dc.modules.sys.user.entity.dto.UserDTO;
import com.tianruan.dc.modules.sys.user.entity.vo.UserVO;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;


@Service
public interface IUserService extends IService<UserDO> {

    UserDTO getUserPermissionByNo(String username);

    Integer getUserPermissionByRoleAndUsername(String username, String roleName);

    IPage<UserVO> pageUser(Page<UserVO> page,
                           String officeId,
                           String no,
                           String username,
                           String name,
                           String phone,
                           String email,
                           List<String> roleIdList);

    IPage<UserVO> pageStudent(Page page,
                              String officeId,
                              String no,
                              String name,
                              String phone,
                              String email);


    /**
     * 搜索教师
     * @param dtoEntity
     * @return
     */
    List<UserVO> searchTeacherList(UserDTO dtoEntity);

    /**
     * 搜索教师
     * @param dtoEntity
     * @return
     */
    PageUtils searchTeacher(UserDTO dtoEntity);

    PageUtils searchStudentByStudent(UserDTO dtoEntity);

    IPage<UserVO> findExpertList(UserDTO dtoEntity);

    IPage<UserVO> findDCExpertList(UserDTO dtoEntity);

    List<String> getUserRoleIdList();

    UserVO getUserRoleById(String id);

    UserDTO updateUser(String id, UserDTO userDTO);

    UserDTO insertUser(UserDTO userDTO);

    String getPassword(String id);

    /**
     * 判断密码是否相等
     * @param id
     * @param password
     * @return
     */
    Boolean equalsPassword(String id, String password);


    /**
     * 根据id修改密码
     * @param id
     * @param password
     */
    void modifyPassword(String id, String password);

    UserDTO getUserByPhone(String phone);

    List<UserDTO> getUserByRoleId(String roleId);

    Boolean importStudent(MultipartFile file);

    Boolean importTeacher(MultipartFile file);

    UserVO getStudentInfo(String userId);

    List<UserVO> serachTeacher(Wrapper<UserDO> queryWrapper);

    List<UserVO> serachStudent(Wrapper<UserDO> queryWrapper);

    Long getStudentCount(String officeId, String enrollmentYear);

    /**
     * 登录
     * @param loginDTO
     * @return
     */
    UserDTO login(LoginDTO loginDTO);

    /**
     * 根据用户名查询id
     * @param username1
     * @return
     */
    UserDTO getIdByUsername(String username1);


}
